<template>
  <div class="content bg">
    <dv-full-screen-container>
      <div class="leftbox">
        <el-dropdown @command="handleCommand">
          <span class="el-dropdown-link">
            <img src="~@/assets/img/kanban.png" alt="" class="img"/>{{ $t(`home.textTitle.${pageItem}`) }}
            <i class="el-icon-caret-bottom el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="pageThree">{{ $t('home.textTitle.pageThree') }}</el-dropdown-item>
            <el-dropdown-item command="pageTwo">{{ $t('home.textTitle.pageTwo') }}</el-dropdown-item>
            <el-dropdown-item command="assemblyModel">{{ $t('home.textTitle.assemblyModel') }}</el-dropdown-item>
            <el-dropdown-item command="workShop1">{{ $t('home.textTitle.workShop1') }}</el-dropdown-item>
            <el-dropdown-item command="workShop2">{{ $t('home.textTitle.workShop2') }}</el-dropdown-item>
            <el-dropdown-item command="workShopMsg">{{ $t('home.textTitle.workShopMsg') }}</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
      <div class="topselect">
        <timeView></timeView>
        <div class="langule">
          <el-dropdown @command="selsectLanguage">
            <span class="el-dropdown-link">
              {{ $t(`home.language.${language}`) }} <i class="el-icon-arrow-down el-icon--right"></i>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item command="zh">{{ $t('home.language.zh') }}</el-dropdown-item>
              <el-dropdown-item command="en">{{ $t('home.language.en') }}</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
      </div>
      <div class="content-box">
        <page-two v-if="pageItem === 'pageTwo'" ref="pageTwo" />
        <page-three v-if="pageItem === 'pageThree'" ref="pageThree" />
      </div>
    </dv-full-screen-container>
  </div>
</template>

<script>
import timeView from "./components/timeView.vue";
import pageTwo from "./manageSystem/pageTwo.vue";
import pageThree from "./manageSystem/pageThree.vue";

export default {
  name: "home",
  components: {
    pageTwo,
    pageThree,
    timeView,
  },
  data() {
    return {
      pageItem: "pageThree",
      language: "zh",
    };
  },
  methods: {
    handleCommand(command) {
      this.pageItem = command;
      if (command === "workShop1") {
        this.$router.push({ path: "/workShop1" });
      } else if (command === "assemblyModel") {
        this.$router.push({ path: "/assemblyModel" });
      } else if (command === "workShop2") {
        this.$router.push({ path: "/workShop2" });
      } else if (command === "workShopMsg") {
        this.$router.push({ path: "/workShopMsg" });
      }
    },
    selsectLanguage(command) {
      this.$i18n.locale = command;
      this.language = command;
    }
  },
};
</script>

<style lang="scss" scoped>
.big-screen {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  text-align: center;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

.big-screen {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.content {
  color: #72b2b2;
  background-color: #060b2b;
  width: 100vw;
  height: 100vh;
  background: url("~@/assets/img/back1.png") no-repeat center;
  background-size: 100% 100%;
}

.title {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30%;
  text-align: center;
  height: 6%;
  font-size: 2.8rem;
  color: #9be5fb;
  font-weight: bold;
  background: url("~@/assets/img/backtop.png") no-repeat center;
  background-size: 100%;
}
.topselect {
  margin: 40px 60px 0 0;
  // width: 500px;
  float: right;
  color: #8993f2;
  font-size: 18px;
  display: flex;
  justify-content: space-around;
  align-items: center;
 
 
}
.leftbox{
  margin: 40px 0 0 40px;
  position: absolute;
}
.el-dropdown-link {
    cursor: pointer;
    color: #8993f2;
    display: flex;
    align-items: center;
    font-size: 16px;
  }
  .el-dropdown-item {
    font-size: 16px;
  }
  .img {
    width: 25px;
    height: 25px;
    margin-right: 5px;
  }
  i {
    color: #d1d9eb;
  }
</style>